package com.hzlj.position.locate.converter;

import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;
import com.hzlj.position.locate.common.dto.reportInitiativeSetting.ReportInitiativeSettingAddDTO;
import com.hzlj.position.locate.common.dto.reportInitiativeSetting.ReportInitiativeSettingQueryResultDTO;
import com.hzlj.position.locate.common.model.ReportInitiativeSetting;

/**
 * 通信联络核查-人脸签到-配置表(ReportInitiativeSetting)DTO转换类
 *
 * @author lifh
 * @date 2023-07-20 10:47:44
 */
public class ReportInitiativeSettingConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static ReportInitiativeSettingQueryResultDTO from(ReportInitiativeSetting model) {
        return ModelDTOConverter.from(model, ReportInitiativeSettingQueryResultDTO.class);
    }

    /**
     * 新增DTO转换为model实例
     *
     * @param dto 新增DTO
     * @return model实例
     */
    public static ReportInitiativeSetting from(ReportInitiativeSettingAddDTO dto) {
        return ModelDTOConverter.from(dto, ReportInitiativeSetting.class, (ReportInitiativeSetting l) -> {
            l.setValid(true);
            l.setUpdateTime(DateUtils.now());
            l.setCreateTime(DateUtils.now());
        });

    }
}
